//
//  MyCollectionViewCell.m
//  豆瓣终极版
//
//  Created by dllo on 15/12/19.
//  Copyright © 2015年 dllo. All rights reserved.
//

#import "MyCollectionViewCell.h"
#import "Movie.h"
#import "UIImageView+WebCache.h"
@interface MyCollectionViewCell ()

@property (nonatomic, retain) UILabel *nameLabel;
@property (nonatomic, retain) UIImageView *myImageView;

@end
@implementation MyCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubView];
    }
    return self;
}
- (void)createSubView{
    self.myImageView = [[UIImageView alloc] initWithFrame:self.contentView.bounds];
    self.myImageView.backgroundColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.myImageView];
    
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 160, 100, 40)];
//    self.nameLabel.backgroundColor = [UIColor lightGrayColor];
    self.nameLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.nameLabel];
    
}

- (void)setMovie:(Movie *)movie{
    if (_movie != movie) {
        [_movie release];
        _movie = [movie retain];
    }
    NSURL *url = [NSURL URLWithString:movie.pic_url];
    [self.myImageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"picholder.png"]];
    self.nameLabel.text = movie.movieName;
    
}
@end
